#ifndef FILTER_DIALOG_H
#define FILTER_DIALOG_H

#include <QDialog>
#include <QLabel>
#include <QListWidget>
#include <QListWidgetItem>
#include <QStackedWidget>
#include <QImage>

#include "../src/spatialFilter.h"
#include "image.h"

#define GRAYSCALE "Greyscale"
#define NEGATIVE "Negativo"
#define LOG "Log"
#define POWER "Potência"
#define THRESHOLDING "Thresholding"
#define HISTOGRAM_EQUALIZATION "Equalização\nde Histograma"
#define HISTOGRAM_MATCHING "Especificação\nde Histograma"
#define LOCAL_HISTOGRAM_PROCESSING "Processamento\nde Histograma\nLocal"
#define LOCAL_HISTOGRAM_PROCESSING_WITH_STATISTICS "Processamento\nde Histograma\nLocal usando\nEstatística"
#define AVERAGE "Média"
#define WEIGHTED_AVERAGE "Média\nPonderada"
#define GAUSSIAN "Gaussiano"
#define ORDER_STATISTIC "Orenação Baseada\nem Informação\nEstatística"
#define LAPLACIAN "Laplaciano"
#define UNSHARP_MASKING_AND_HIGHBOOST_FILTERING "Máscara de Nitidez\ne Filtro de Alta\nAmplificação"
#define GRADIENT "Gradiente"


class FilterDialog : public QDialog{
    Q_OBJECT

    public:
        FilterDialog(QWidget *, QImage *);
        ~FilterDialog();

        void changeFilter(QString);

    signals:
        void done(QImage *);
        void done();

    public slots:
        void apply();
        void changePage(QListWidgetItem *, QListWidgetItem *);
        void powerFilter();
        void thresholdingFilter();
        void histogramMatchingFilter();
        void localHistogramProcessingFilter();
        void localHistogramProcessingWithStatisticsFilter();
        void averageFilter();
        void weightedAverageFilter();
        void gaussianFilter();
        void orderStatisticFilter();
        void laplacianFilter();
        void unsharpMaskingAndHighboostFilter();
        void gradientFilter();

    private:
        void createIcons();
        void addButton(QListWidgetItem *, QString, QString);

        void update();
        void revert();

        Filter *filter;
        QImage *originalImage;
        QImage *testImage;

        Image *preview;
        QListWidget *contentsWidget;
        QStackedWidget *pagesWidget;
};

#endif
